import Vue from "vue"
import App from "./App.vue"
import router from "./router"
import store from "./store"
import "./plugins/element.js"
import "./plugins/moment.js"
import "./plugins/axios.js"
import "./plugins/common.js"
import "normalize.css"// A modern alternative to CSS resets
import "./styles/c.less"
import "./components"
import "./filter"
import  {Vue2Storage} from "vue2-storage"
import ports from "@/utils/ports"
Vue.config.productionTip = false

Vue.prototype.$ports = ports;

Vue.use(Vue2Storage, {
	prefix: "app_",
	driver: "local",
	ttl: 60 * 60 * 24 * 1000 // 24 часа
})

//字典数据
Vue.directive("auth", {
	bind: function (el, binding) {
		let value = binding.value;//在页面上绑定的 对应权限显示
		var roles = store.state.user.auths;//获取的用户权限
		if(store.state.user.name !== "admin" ){
			el.style.display="none";
			if(value && typeof(value)==="string" &&roles.findIndex(value)){
				el.style.display="block";
			}
		}
	}
});

new Vue({
	router,
	store,
	render: h => h(App),
}).$mount("#app")




